package com.example.tool.adapter;

import android.content.Context;
import android.support.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.tool.R;
import com.example.tool.bean.CommonBean;

import java.util.List;

/**
 * Created Date 2019/9/23
 *
 * @author liangkun
 * description：单个
 */
public class SingleAdapter extends BaseQuickAdapter<CommonBean, BaseViewHolder> {
    private Context context;

    public SingleAdapter(Context context, List<CommonBean> list) {
        super(R.layout.item_pic_text, list);
        this.context = context;
    }

    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * @param helper A fully initialized helper.
     * @param item   The item that needs to be displayed.
     */
    @Override
    protected void convert(@NonNull BaseViewHolder helper, CommonBean item) {
        helper.setText(R.id.tv_number, String.format(context.getResources().getString(R.string.see_number), item.getDes()));


        helper.setText(R.id.tv_click, "点击我").addOnClickListener(R.id.tv_click)
                .addOnLongClickListener(R.id.tv_click).linkify(R.id.tv_click);

        helper.setText(R.id.tv_title, item.getTitle())
                .addOnClickListener(R.id.tv_title)
                .addOnLongClickListener(R.id.tv_title).linkify(R.id.tv_title);



//        helper.setOnClickListener(R.id.iv_head_d, new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//            }
//        });
//        helper.addOnClickListener(R.id.iv_head_d);
//        helper.addOnClickListener(R.id.iv_foot_d);


//        helper.addOnClickListener(R.id.rl_container)
//                .addOnLongClickListener(R.id.rl_container);


//        helper.setImageResource(R.id.icon, item.getImageResource());
//        // 加载网络图片
//        Glide.with(mContext).load(item.getUserAvatar()).crossFade().into((ImageView) helper.getView(R.id.iv));


//        helper.setText(R.id.tweetName, item.getUserName())
//                .setText(R.id.tweetText, item.getText())
//                .setText(R.id.tweetDate, item.getCreatedAt())
//                .setVisible(R.id.tweetRT, item.isRetweet())
//                .linkify(R.id.tweetText);
//        Glide.with(mContext).load(item.getUserAvatar()).crossFade().into((ImageView) helper.getView(R.id.iv));
    }

}
